/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

package com.facebook.drawee.drawable;

import ohos.agp.components.element.Element;

public interface Callback {
    /**
     * Called when the drawable needs to be redrawn.  A view at this point
     * should invalidate itself (or at least the part of itself where the
     * drawable appears).
     *
     * @param who The drawable that is requesting the update.
     */
    void invalidateDrawable( Element who);

    /**
     * A Drawable can call this to schedule the next frame of its
     * animation.  An implementation can generally simply call with
     * the parameters <var>(what, who, when)</var> to perform the
     * scheduling.
     *
     * @param who The drawable being scheduled.
     * @param what The action to execute.
     * @param when The time (in milliseconds) to run.  The timebase is
     */
    void scheduleDrawable(Element who, Runnable what, long when);

    /**
     * A Drawable can call this to unschedule an action previously
     * scheduled with {@link #scheduleDrawable}.  An implementation can
     * generally simply call with
     * the parameters <var>(what, who)</var> to unschedule the drawable.
     *
     * @param who The drawable being unscheduled.
     * @param what The action being unscheduled.
     */
    void unscheduleDrawable(Element who, Runnable what);
}